#ifndef LOG_H
#define LOG_H

#include <QObject>
#include <QString>
#include "environment.h"

class CLog: public QObject
{
    Q_OBJECT

private:
    QString path;
    void save(QString filename,double value, double ole_date);
    void save(QString filename, QString message);
    double toOle(QDateTime dtime);
    QTimer logTimer;
public:
    CLog():path(QString::null){
        connect(&logTimer,SIGNAL(timeout()), this, SLOT(Process()));
    }
    void setDirectory(QString p){path = p;}
    void setInterval(int interval){
        if (interval>0)
            logTimer.start(interval);
        else logTimer.stop();
    }
private slots:
    void Process();
};

#endif // LOG_H
